package zhang.automobileservice;

import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;


/**
 * Created by Administrator on 2016/7/18.
 */
public class GuideActivity extends FarterActivity implements View.OnClickListener {
    private ImageView iv_guide1;
    private ImageView iv_guide2;
    private ImageView iv_guide3;
    private ImageView iv_guide4;
    private Button bt_guide1;
    private Button bt_guide2;
    private Button bt_guide3;
    private Button bt_guide4;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guide);
        initView();

    }

    private void initView() {
        iv_guide1 = (ImageView) findViewById(R.id.iv_guide1);
        iv_guide2 = (ImageView) findViewById(R.id.iv_guide2);
        iv_guide3 = (ImageView) findViewById(R.id.iv_guide3);
        iv_guide4 = (ImageView) findViewById(R.id.iv_guide4);
        bt_guide1 = (Button) findViewById(R.id.bt_guide1);
        bt_guide2 = (Button) findViewById(R.id.bt_guide2);
        bt_guide3 = (Button) findViewById(R.id.bt_guide3);
        bt_guide4 = (Button) findViewById(R.id.bt_guide4);

        bt_guide1.setOnClickListener(this);
        bt_guide2.setOnClickListener(this);
        bt_guide3.setOnClickListener(this);
        bt_guide4.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_guide1:
                ObjectAnimator anima1 = ObjectAnimator.ofFloat(iv_guide1,"translationX",0,-1080);
                ObjectAnimator anima2 = ObjectAnimator.ofFloat(bt_guide1,"translationX",0,-1080);
                anima1.setDuration(1000);
                anima2.setDuration(1000);
                anima1.start();
                anima2.start();
                break;
            case R.id.bt_guide2:
                ObjectAnimator anima3 = ObjectAnimator.ofFloat(iv_guide2,"translationX",0,-1080);
                ObjectAnimator anima4 = ObjectAnimator.ofFloat(bt_guide2,"translationX",0,-1080);
                anima3.setDuration(1000);
                anima4.setDuration(1000);
                anima3.start();
                anima4.start();
                break;
            case R.id.bt_guide3:
                ObjectAnimator anima5 = ObjectAnimator.ofFloat(iv_guide3,"translationX",0,-1080);
                ObjectAnimator anima6 = ObjectAnimator.ofFloat(bt_guide3,"translationX",0,-1080);
                anima5.setDuration(1000);
                anima6.setDuration(1000);
                anima5.start();
                anima6.start();
                break;
            case R.id.bt_guide4:
                Intent intent  = new Intent(this,FirstpageActivity.class);
                startActivity(intent);
                finish();
                break;
        }
    }

}
